package com.codeanalysissys.backend.utils;

import com.codeanalysissys.backend.Execution;
import com.codeanalysissys.backend.entity.Analysis;
import com.codeanalysissys.backend.entity.AnalysisArgs;
import com.codeanalysissys.backend.entity.Language;
import org.springframework.stereotype.Component;

import java.io.InputStream;
import java.util.ArrayList;

@Component
public class AnalysisArgsBuilder {
    private AnalysisArgs args;

    public AnalysisArgsBuilder() {
        args = new AnalysisArgs();
    }

    public AnalysisArgs build() {
        args.formats = Execution.Formats.JSON;
        return args;
    }

    public AnalysisArgsBuilder setLanguageType(Language languageType) {
        args.lang = languageType;
        return this;
    }

    public AnalysisArgsBuilder setAnalysisOpt(ArrayList<Analysis> opt) {
        args.opt = opt;
        return this;
    }

    public AnalysisArgsBuilder setFileName(String fileName) {
        args.fileName = fileName;
        return this;
    }

    public AnalysisArgsBuilder setInputStream(InputStream stream) {
        args.inputStream = stream;
        return this;
    }
}
